home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Apple II / System 6.0 Sample Code / FinderXDA / FinderXDA.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  13.4 KB  |  256 lines  |  [TEXT/MPS ]

  1. #include "typesiigs.r"
  2. #include "rDefs.h"
  3.  
  4.  
  5.  
  6. /* Can't pass TEInsert rTextForLETextBox2 due to bug in text edit */
  7. /* so I use rText insead */
  8. /*
  9. resource rTextForLETextBox2 (1) { 
  10. };
  11. */
  12.  
  13. resource rVersion (1) {
  14.     {1,0,0,beta,1},
  15.     verUS,
  16.     "FinderXDA",
  17.     "Copyright 1989-91, Apple Computer, Inc."
  18.     };
  19.  
  20. resource rComment (1) {
  21. "The FinderXDA is a Finder Extension which tests all the SendRequest codes "
  22. "which can be passed to the Finder by a Finder Extension or can be passed by "
  23. "the Finder to a Finder Extension. 'finderSays' codes are passed by the Finder "
  24. "to the Finder Extension and 'tellFinder' codes are sent by the Finder "
  25. "Extension to the Finder."
  26. };
  27.  
  28.  
  29. resource rControlTemplate (HelpEditTextControlID) {
  30.     HelpEditTextControlID,                    //    control ID
  31.     {0,0,157,560},                            //    rect
  32.     editTextControl {{
  33.         0b0000000000000000,                    //    flags
  34.         0b0111010000001111,                    //    more flags
  35.         0,                                    //    refCon
  36.         0b01000100000100000000000000000000,    //    text flags
  37.         {0xFFFF,0xFFFF,0xFFFF,0xFFFF},        //    indent rect
  38.         0xFFFFFFFF,                            //    vert scroll bar
  39.         0x0000,                                //    vert scroll amount
  40.         0,                                    //    horiz scroll bar
  41.         0,                                    //    horiz scroll amount
  42.         0,                                    //    style ref
  43.         0b0000000000010101,                    //    text descriptor
  44.         HelpTextControlID,                    //    text ref
  45.         0                                    //    text length
  46.     }},
  47. };
  48.  
  49. resource rText (2) {
  50. "FinderXDA V1.0b1\n"
  51. "Written by Bob Haven\n"
  52. "Date 3/3/91\n\n"
  53. "Thanks to:\n"
  54. "John Selhorst for his programming help\n"
  55. "Margarita Sang for her testing of this DA\n"
  56. "Andy 'FinderMan' Nicholas and Dave 'Tangent' Lyons for their debugging sessions\n\n"
  57.  
  58. "This DA tests the Finder's Inter-Process Communication features. Anything that communicates "
  59. "via AcceptRequest or SendRequest calls to the Finder is a Finder Extension. Finder Extensions "
  60. "make AcceptRequest calls to receive finderSays requests codes from the Finder. Finder "
  61. "Extensions make SendRequest calls to pass tellFinder request codes to the Finder.\n\n"
  62.  
  63. "This DA can send and receive all currently supported request codes by using the various menus "
  64. "and buttons in main DA window (tiltled 'FinderXDA'). This DA can receive all finderSays request "
  65. "codes by using the finderSays menu. All but two of the tellFinder request codes can be sent by "
  66. "this DA by using the tellFinder menu. The other two tellFinder request codes are sent by using "
  67. "the MItemSelected menu or the tellFinderColorSelection button. The remaining TextEdit and "
  68. "checkbox controls are used in conjunction with the other controls. Details of their use is "
  69. "provided below.\n\n"
  70.  
  71. "The 'finderSays' Menu\n\n"
  72.  
  73. "The 'finderSays' menu installs separate request procs for each of the finderSays requests "
  74. "codes. When you select one of the menui tems in this menu an AcceptRequests call is made, "
  75. "passing the Finder the address of a 'RequestProc', which is your procedure to handle one "
  76. "or any selected finderSays requests codes that the finder directs to your RequestProc. "
  77. "Normally an application would use only one RequestProc to handle all finderSays request "
  78. "codes, but I've broken them up to be handled by separate RequestProcs to simplify testing. "
  79. "The last menu item removes all the RequestProcs. The following is a list of the finderSays "
  80. "menu items and a short description of what they do:\n\n"
  81.  
  82. "finderSaysHello - Installs a RequestProc to handle the finderSaysMItemSelected "
  83. "request code. The finderSaysHello request code is sent by the Finder whenever the "
  84. "the Finder launches.\n\n"
  85.  
  86. "finderSaysGoodbye - Installs a RequestProc to handle the finderSaysMItemSelected "
  87. "request code. The finderSaysGoodbye request code is sent by the Finder whenever the "
  88. "the Finder quits.\n\n"
  89.  
  90. "finderSaysSelectionChanged - Installs a RequestProc to handle the finderSaysMItemSelected "
  91. "request code. The finderSaysSelectionChanged request code is sent whenever a Finder "
  92. "selection may have changed (i.e. clicking on a finder window, desktop, or desktop icon).\n\n"
  93.  
  94. "finderSaysMItemSelected - Installs a RequestProc to handle the finderSaysMItemSelected "
  95. "request code. This request code is sent by the Finder whenever a menu selection from the "
  96. "System MenuBar. The AbortItFlag checkbox below is used to set the abortItFlag field of "
  97. "the dataOut buffer returned to the Finder. If this box is checked then the Finder will "
  98. "abort the selection of the menu item. The Finder will continue handling the menu item "
  99. "if this box is unchecked. The dataIn buffer for each request is displayed in an alert "
  100. "window.\n\n" 
  101.  
  102. "finderSaysBeforeOpen - Installs a RequestProc to handle the finderSaysBeforeOpen "
  103. "request code. This request code is sent whenever the Finder tries to open a document. "
  104. "One request code is sent for each document you try to open. The dataIn buffer for each "
  105. "request is displayed in an alert window.\n\n" 
  106.  
  107. "finderSaysOpenFailed - Installs a RequestProc to handle the finderSaysOpenFailed "
  108. "request code. This request code is sent whenever the Finder tries to open a document "
  109. "and can't find and application that supports opening the document through the "
  110. "application. One request code is sent for each document you try to open. The dataIn buffer "
  111. "for each request is displayed in an alert window.\n\n"
  112.  
  113. "finderSaysBeforeCopy - Installs a RequestProc to handle the finderSaysBeforeCopy "
  114. "request code. This request code is is sent whenever you try to copy a file. It doesn't "
  115. "work for duplicating files.\n\n"
  116.  
  117. "finderSaysIdle - Installs a RequestProc to handle the finderSaysIdle request code. This "
  118. "request code is is sent whenever the Finder is idle. A small Rect is alternately filled "
  119. "and erased when this request code is sent.\n\n"
  120.  
  121. "finderSaysExtrasChosen - Installs a RequestProc to handle the finderSaysMItemSelected "
  122. "request code. This request code is sent whenever a Extras Menu menu item is selected that "
  123. "belongs to the FInderXDA.\n\n"
  124.  
  125. "finderSaysBeforeRename - Installs a RequestProc to handle the finderSaysBeforeRename "
  126. "request code. This request code is is sent whenever you try to rename a file.\n\n"
  127.  
  128. "finderSaysKeyHit - Installs a RequestProc to handle the finderSaysKeyHit request code. "
  129. "This request code is sent whenever a key is hit that the Finder doesn't handle. For "
  130. "example, almost any non-command key when you're not renaming an icon. To type keypresses "
  131. "to the Finder with FinderXDA open, bring a Finder window to the front (or, if GSBug is "
  132. "installed, put Caps Lock down).\n\n"  
  133.  
  134. "Remove Request Procs - Removes all RequestProcs so that all finderSays request codes "
  135. "will not be handled by this DA. Use this menu item in conjunction with the other "
  136. "'finderSays' menu items to block undesired request codes coming from the Finder.\n\n"
  137.  
  138. "The 'tellFinder' Menu\n\n"
  139.  
  140. "The 'tellFinder' menu exercises all but one of the Finder SendRequest codes. When a "
  141. "SendRequest code is sent to the Finder, the Finder usually returns an output buffer "
  142. "(dataOut) which contains the result of the call and other info. If a buffer is returned, "
  143. "the result fields are displayed in a alert window. The following lists the 'tellFinder' "
  144. "menu items and a short desription of what they do:\n\n"
  145.  
  146. "tellFinderGetDebugInfo - Calls SendRequest with the tellFinderGetDebugInfo request code. "
  147. "The dataOut buffer is dispalyed in an alert window.\n\n"
  148.  
  149. "askFinderAreYouThere - Calls SendRequest with the askFinderAreYouThere request code.\n\n"
  150.  
  151. "tellFinderOpenWindow - Calls SendRequest with the tellFinderOpenWindow request code. "
  152. "Type a valid GS pathname into the text edit control in the FX window and then select "
  153. "this menu item. If the pathname is correct the window will be opened. GS/OS errors "
  154. "(like $45 - volume not found or $40 - bad pathname syntax) will be returned in the "
  155. "output buffer. All pathnames should start with a colon except special windows (Trash, "
  156. "Clip, and About).\n\n"
  157.  
  158. "tellFinderCloseWindow - Calls SendRequest with the tellFinderCloseWindow request code. "
  159. "Type in a valid GS pathname of an open window and then select this menu item. If the "
  160. "pathname is correct the window will be closed. If the pathname is incorrect an error "
  161. "will be returned in the output buffer.\n\n"
  162.  
  163. "tellFinderGetSelectedIcons - Calls SendRequest with the tellFinderGetSelectedIcons "
  164. "request code. Select one or several icons in a Finder window or on the desktop and "
  165. "then select this menu item. After clearing the alert window another window will be "
  166. "displayed containing the pathnames of the selected icons.\n\n"
  167.  
  168. "tellFinderGetSelectedIcons(Extended) - Calls SendRequest with the tellFinderGetSelectedIcons "
  169. "request code with bit 31 of dataIn set. Does the same thing as tellFinderGetSelectedIcons, "
  170. "only the returned stringListHandle is for extended icons.\n\n"
  171.  
  172. "tellFinderSetSelectedIcons - Calls SendRequest with the tellFinderSetSelectedIcons "
  173. "request code. Select an icon or icons from a window or the desktop and then select "
  174. "the tellFinderGetSeletectedIcons menu item. Deselect icons and then select the "
  175. "tellFinderSetSelcetedIcons menu item. The stringListHandle from the tellFinderGetSelectedIcons "
  176. "is passed as dataIn to tellFinderSetSelectedIcons. The 'Deselect Icons' checkbox, if selected, "
  177. "causes any other selected icons to be deselected prior to selecting the icons in the "
  178. "stringListHandle. The checkbox doesn't work due to a Finder 6.0 bug. See the Finder 6.0 "
  179. "documentation.\n\n"
  180.  
  181. "tellFinderLaunchThis(Ap) - Calls SendRequest with the tellFinderLaunchThis request "
  182. "code. Type in valid GS pathname to an application and select this menu item. The "
  183. "Finder will quit and the application will be launched.\n\n"
  184.  
  185. "tellFinderLaunchThis(Doc) - Calls SendRequest with the tellFinderLaunchThis request "
  186. "code. Type in a valid GS pathname to a document, whose application supports launching by "
  187. "opening the document, and select this menu item. The Finder will quit and the "
  188. "application will be launched. This request codes is currently not implemented by the "
  189. "Finder.\n\n"
  190.  
  191. "tellFinderShutDown(Off) - Calls SendRequest with the tellFinderShutDown request code "
  192. "with dataIn set to 0 - turn off power.\n\n"
  193.  
  194. "tellFinderShutDown(Restart) - Calls SendRequest with the tellFinderShutDown request code "
  195. "with dataIn set to 1 - restart system.\n\n"
  196.  
  197. "tellFinderShutDown(Quit) - Calls SendRequest with the tellFinderShutDown request code "
  198. "with dataIn set to 2 - quit Finder.\n\n"
  199.  
  200. "tellFinderMatchFileToIcon - Calls SendRequest with the tellFinderMatchFileToIcon request "
  201. "code. This request code is not yet implemented in this NDA.\n\n"
  202.  
  203. "tellFinderAddBundle - Calls SendRequest with the tellFinderAddBundle request code. This "
  204. "request code is not yet implemented in this NDA.\n\n"
  205.  
  206. "tellFinderAboutChange - Calls SendRequest with the tellFinderAboutChange request code. "
  207. "Type a valid pathname into the Pathname Text Edit Control and select the tellFinderAboutChange "
  208. "menu item. If the pathname is to an open window you should see the Finder update the window "
  209. "after you clear the alert window.\n\n"
  210.  
  211. "tellFinderCheckDatabase - Calls SendRequest with the tellFinderCheckDatabase request code. "
  212. "This request code is not yet implemented in this NDA.\n\n"
  213.  
  214. "tellFinderAddToExtras - Calls SendRequest with the tellFinderAddToExtras request code. "
  215. "A new menu item will be installed into the Exras menu. This DA allows only 16 menu items to "
  216. "be added.\n\n"
  217.  
  218. "askFinderIdleHowLong - Calls SendRequest with the askFinderIdleHowLong request code. "
  219. "The number of ticks since the last Finder event is displayed in an alert window.\n\n" 
  220.  
  221. "tellFinderGetWindowIcons - Calls SendRequest with the tellFinderGetWindowIcons request "
  222. "code. I've set the DA up to return the list of icon pathnames for the window directly "
  223. "into another window.\n\n"
  224.  
  225. "tellFinderGetWindowIcons(Extended) - Calls SendRequest with the tellFinderGetWindowIcons "
  226. "request code with bit 31 of dataIn set. Does the same thing as tellFinderGetWindowIcons, "
  227. "only the returned stringListHandle contains extended icons. See Finder 6.0 documentation, "
  228. "a Finder patch was required to make this feature work in this DA.\n\n"
  229.  
  230. "tellFinderGetWindowInfo - Calls SendRequest with the tellFinderGetWindowInfo request "
  231. "code. Returns window info for the window directly beneath the DA window.\n\n"
  232.  
  233. "tellFinderRemoveFromExtras - Calls SendRequest with the tellFinderRemoveFromExtras "
  234. "request code. Removes the last menu item added to the Extas menu. This DA will allow "
  235. "you to remove only the menu items that you installed.\n\n"
  236.  
  237. "tellFinderSpecialPreferences - Calls SendRequest with the tellFinderSpecialPreferences "
  238. "request code. Before it calls SendRequest it puts up a dialog asking how you want to "
  239. "set up the dataIn buffer for the SendRequest call.\n\n"
  240.  
  241. "The tellFinderMItemSelected Menu\n\n"
  242.  
  243. "tellFinderMItemSelected - Calls SendRequest with the tellFinderMItemSelected request "
  244. "code. This will cause of the specified menu item in the System MenuBar to be selected. "
  245. "If the 'MItem Hilite Bit' CheckBox is checked, the the menu owning the menu item to be "
  246. "selected will be hilited during the operation. If the checkbox is not selected the the "
  247. "menu item will still be selected, but will not be hilited during the operation.\n\n"
  248.  
  249. "The 'tellFinderColorSelection' Button and 'Icon Color' TextEdit controls are used to send "
  250. "the tellFinderColorSelection request code to the Finder. To do this, select one or more "
  251. "icons on the desktop or within a folder, type in a color value into the 'Icon Color' "
  252. "TextEdit field (using the proper format), and then select the tellFinderColorSelction "
  253. "button. The selected icons should be redrawn in the color passed in the call."
  254.  
  255. };
  256.